

public class lx {

	
	
	public static int[] numArray= {5,3,11,34,6,13,7,22,7,8,2};
	public static int sum=0;
	public static void main(String[] argc){
		
		
	
		
		
		
	int len=numArray.length;
	insertSort(len);
	for(int i=0;i<len;i++) {
		
		echo(numArray[i]+" ");
	}

		
		
		
		
		
		
		
		
	
	}
	
	
	
	
	public static void insertSort(int n) {
		
		int i=n,temp,j;
		
		
		for(i=1;i<n;i++) {
			
			
			temp=numArray[i];
			
			for(j=i-1;j>=0;j--) {
				
				
				if(numArray[j] > temp) {
					
				
					numArray[j+1] =numArray[j];
				}else {
					
					break;//if order is ok direct break to next for
				}
				
				
			}
			
			numArray[j+1]=temp;
			
			
			
		}
		
		
		
		
		
		
		
	}
	
	
	
	public static void echo(int  msg){
		
		
		System.out.print(msg);
	}
	public static void echo(String msg){
		
		
		System.out.print(msg);
	}
	public static void echoln(String msg) {
		
		
		echo(msg+"\n");
	}

	

}

